$(function () {
    var layer = layui.layer
    var form = layui.form
    // ****************************************编辑用户
    let id = location.href.split('?')[1]
    $.ajax({
        url: `/admin/users/${id}`,
        type: 'GET',
        success: function (res) {
            form.val("editForm", res.data);
        }
    })
    $('form').on('submit', function (e) {
        e.preventDefault()
        let data = form.val("editForm")
        $.ajax({
            type: "PUT",
            url: '/admin/users',
            data: data,
            success: function (res) {
                layer.msg(res.message)
            }
        })
    })



})